<p>
<%= form_tag ({:action=>'unapproved_users'}, {:method=>:get}) %>
<label>Show users from </label>
<select name="filter_office" style="width:150px">
	<%= options_for_select(options_for_offices.map{|e| [e[0],e[1].to_s]}<<['All Offices','none'],session[:filter_office]) %>
</select> 
<%= submit_tag 'Filter'%>
<%= end_form_tag %>
</p>

<div id="user_table">
<table width="100%">
<tr>
<th>Name</th>
<th>email</th>
<th>Roles</th>
<th>Fields</th>
<th>Certificates</th>
</tr>
<% i=1 %>
<% @users.each{|user|%>
<%i = i+1%>
<tr class="<%=i.even? ? "even_row" : "odd_row" %>" > 
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:5px;padding-top:5px">
	<%=link_to user.last_name+', '+user.first_names, :controller=>'profile', :action=>'view', :id=>user.id%>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:5px;padding-top:5px ">
<small><a href="mailto:<%=h user.email %>" <%= user.email_verified? ? '' : "class=\"unapproved\""%> ><%= user.email %> </a></small>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:5px;padding-top:5px">
    <%user.unapproved_groups.each{|group|%>
	        <span class="unapproved"><%= group['group_name']%></span>
	 <%}%>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:5px;padding-top:5px">
		<%="<label class=\"unapproved\">Birthdate:</label><br/> #{user.birthdate}<br/>"  unless user.birthdate_approved %>
		<%="<label class=\"unapproved\">Medical Date:</label><br/> #{user.faa_physical_date}<br/>"  unless user.physical_approved %>
		<%="<label class=\"unapproved\">Biennial/Certification Date:</label><br/> #{user.last_biennial_or_certificate_date}<br/>"  unless user.biennial_approved %>
		<%="<label class=\"unapproved\">US Citizen:</label><br/> #{user.is_us_citizen}"  unless user.us_citizen_approved %>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:5px;padding-top:5px">
						<table width="100%">
							<% user.unapproved_certificates.each{|certificate| %>
								<tr>
									<td style="vertical-align:top;" width="45%">
										<label class="unapproved"><%= certificate.certificate_category %></label>
									</td>
									<td style="vertical-align:top;">
										<% if certificate.airplane_sel_rating %>
										 <div class="unapproved">Airplane SEL</div>
										<% end %>
										<% if certificate.airplane_mel_rating %>
										 <div class="unapproved">Airplane MEL</div>
										<% end %>
										<% if certificate.helicopter_rating%>
										 <div class="unapproved">Helicopter</div>
										<% end %>
										<% if certificate.instrument_rating%>
										 <div class="unapproved">Instrument</div>
										<% end %>
									</td>
								</tr>
							<% } %>
						</table>
</td>
<td style="vertical-align:center; border-bottom: 1px solid black; padding-bottom:5px;padding-top:5px"> 
	<%= start_form_tag :action=>'approve_user_items',:id=>user.id %><%= submit_tag 'Approve'%> <%= end_form_tag %>
</td>
</tr>   


<% }%>
</table>
</div>
